<!--
 * @Author: 追逐的娃 kangchao_php@163.com
 * @Date: 2024-05-08 11:20:38
 * @LastEditors: 追逐的娃 kangchao_php@163.com
 * @LastEditTime: 2024-05-08 14:41:43
 * @FilePath: \huijie-admin\src\components\addModal.vue
 * @Description: 
 * 
-->
<template>
<el-dialog
    v-model="visible"
    :title="title"
    :width="width"
    :before-close="handleClose"
  >
    <slot></slot>
    <template #footer>
      <div class="dialog-footer">
        <el-button >{{cancelText}}</el-button>
        <el-button type="primary" @click="emits('submit')">
          {{confirmText}}
        </el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script setup>
import { ref } from 'vue'

const props = defineProps({
    title: {
        type: String,
        default: '弹框'
    },
     width: {
        type: [String,Number],
        default: 500
    },
    cancelText: {
        type: String,
        default: '取消'
    },
    confirmText: {
        type: String,
        default: '确定'
    }
})

const visible = ref(false)

//打开弹窗
const openDialog = () => visible.value = true
//关闭弹窗
const closeDialog = () => visible.value = false

const handleClose = () => {}

const emits = defineEmits(['submit'])
defineExpose({
    openDialog,
    closeDialog
})
</script>

<style lang='less' scoped>

</style>